home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / RCS / stdio.h,v < prev    next >
Encoding:
Text File  |  1992-08-05  |  26.9 KB  |  1,128 lines

  1. head     1.28;
  2. branch   ;
  3. access   ;
  4. symbols  sprited:1.27.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.28
  10. date     92.08.05.11.17.34;  author ouster;  state Exp;
  11. branches ;
  12. next     1.27;
  13.  
  14. 1.27
  15. date     91.12.05.10.44.56;  author ouster;  state Exp;
  16. branches 1.27.1.1;
  17. next     1.26;
  18.  
  19. 1.26
  20. date     90.12.07.23.46.20;  author rab;  state Exp;
  21. branches ;
  22. next     1.25;
  23.  
  24. 1.25
  25. date     90.11.06.17.20.54;  author rab;  state Exp;
  26. branches ;
  27. next     1.24;
  28.  
  29. 1.24
  30. date     90.09.20.15.48.34;  author mgbaker;  state Exp;
  31. branches ;
  32. next     1.23;
  33.  
  34. 1.23
  35. date     90.09.11.16.45.07;  author mendel;  state Exp;
  36. branches ;
  37. next     1.22;
  38.  
  39. 1.22
  40. date     90.09.11.14.35.26;  author kupfer;  state Exp;
  41. branches ;
  42. next     1.21;
  43.  
  44. 1.21
  45. date     90.09.03.22.23.56;  author shirriff;  state Exp;
  46. branches ;
  47. next     1.20;
  48.  
  49. 1.20
  50. date     90.09.03.11.01.36;  author kupfer;  state Exp;
  51. branches ;
  52. next     1.19;
  53.  
  54. 1.19
  55. date     90.06.27.13.29.57;  author shirriff;  state Exp;
  56. branches ;
  57. next     1.18;
  58.  
  59. 1.18
  60. date     90.06.21.09.47.47;  author rab;  state Exp;
  61. branches ;
  62. next     1.17;
  63.  
  64. 1.17
  65. date     89.06.23.11.30.01;  author rab;  state Exp;
  66. branches ;
  67. next     1.16;
  68.  
  69. 1.16
  70. date     88.11.23.17.38.05;  author mlgray;  state Exp;
  71. branches ;
  72. next     1.15;
  73.  
  74. 1.15
  75. date     88.09.28.09.20.58;  author ouster;  state Exp;
  76. branches ;
  77. next     1.14;
  78.  
  79. 1.14
  80. date     88.09.14.10.40.52;  author ouster;  state Exp;
  81. branches ;
  82. next     1.13;
  83.  
  84. 1.13
  85. date     88.07.28.16.43.57;  author ouster;  state Exp;
  86. branches ;
  87. next     1.12;
  88.  
  89. 1.12
  90. date     88.07.25.13.59.27;  author ouster;  state Exp;
  91. branches ;
  92. next     1.11;
  93.  
  94. 1.11
  95. date     88.07.25.11.02.38;  author ouster;  state Exp;
  96. branches ;
  97. next     1.10;
  98.  
  99. 1.10
  100. date     88.07.21.16.03.45;  author ouster;  state Exp;
  101. branches ;
  102. next     1.9;
  103.  
  104. 1.9
  105. date     88.07.21.08.43.43;  author ouster;  state Exp;
  106. branches ;
  107. next     1.8;
  108.  
  109. 1.8
  110. date     88.07.20.18.12.28;  author ouster;  state Exp;
  111. branches ;
  112. next     1.7;
  113.  
  114. 1.7
  115. date     88.07.15.17.28.13;  author ouster;  state Exp;
  116. branches ;
  117. next     1.6;
  118.  
  119. 1.6
  120. date     88.07.11.09.09.56;  author ouster;  state Exp;
  121. branches ;
  122. next     1.5;
  123.  
  124. 1.5
  125. date     88.07.05.10.11.23;  author ouster;  state Exp;
  126. branches ;
  127. next     1.4;
  128.  
  129. 1.4
  130. date     88.07.05.09.14.28;  author ouster;  state Exp;
  131. branches ;
  132. next     1.3;
  133.  
  134. 1.3
  135. date     88.07.05.09.05.34;  author ouster;  state Exp;
  136. branches ;
  137. next     1.2;
  138.  
  139. 1.2
  140. date     88.06.26.16.05.04;  author ouster;  state Exp;
  141. branches ;
  142. next     1.1;
  143.  
  144. 1.1
  145. date     88.06.21.09.36.57;  author ouster;  state Exp;
  146. branches ;
  147. next     ;
  148.  
  149. 1.27.1.1
  150. date     92.03.20.22.20.47;  author kupfer;  state Exp;
  151. branches ;
  152. next     ;
  153.  
  154.  
  155. desc
  156. @@
  157.  
  158.  
  159. 1.28
  160. log
  161. @Changed fseek arguments to conform to POSIX.
  162. @
  163. text
  164. @/*
  165.  * stdio.h --
  166.  *
  167.  *    This header file declares the stdio library facilities.  They
  168.  *    provide a general stream facility and routines for formatted
  169.  *    input and output.
  170.  *
  171.  * Copyright 1986, 1988 Regents of the University of California
  172.  * Permission to use, copy, modify, and distribute this
  173.  * software and its documentation for any purpose and without
  174.  * fee is hereby granted, provided that the above copyright
  175.  * notice appear in all copies.  The University of California
  176.  * makes no representations about the suitability of this
  177.  * software for any purpose.  It is provided "as is" without
  178.  * express or implied warranty.
  179.  *
  180.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.27 91/12/05 10:44:56 ouster Exp Locker: ouster $ SPRITE (Berkeley)
  181.  */
  182.  
  183. #ifndef _STDIO_H
  184. #define _STDIO_H
  185.  
  186. /* 
  187.  * sprite.h is needed for typedefs that are used in some function
  188.  * prototypes.  Unfortunately, some user programs define conflicting
  189.  * typedefs.  Because practically everyone uses stdio.h, only include
  190.  * <sprite.h> if function prototypes are enabled (i.e. we're in the
  191.  * kernel or the user has explicitly asked for prototypes).
  192.  */
  193. #include <cfuncproto.h>
  194.  
  195. #ifdef _HAS_PROTOTYPES
  196. #include <sprite.h>
  197. #endif
  198.  
  199. #ifndef EOF
  200. #define EOF (-1)
  201. #endif
  202.  
  203. #ifndef NULL
  204. #define NULL 0
  205. #endif
  206.  
  207. #ifndef _CLIENTDATA
  208. typedef int *ClientData;
  209. #define _CLIENTDATA
  210. #endif
  211.  
  212. #ifndef _VA_LIST
  213. #define _VA_LIST
  214. typedef char *va_list;
  215. #endif
  216.  
  217. /*
  218.  * The main data structure used by the stdio module is a FILE.  This
  219.  * describes a byte-sequential communication channel.  The channel
  220.  * includes buffer storage and the names of three stream-dependent
  221.  * procedures:
  222.  *
  223.  * The procedure readProc is called when another byte of data is needed
  224.  * and the buffer is empty (readCount == 0).  It should read more data
  225.  * into the buffer, reset readCount and lastAccess, and set the STDIO_EOF
  226.  * flag and/or status field if any problem occurred while reading the data.
  227.  *
  228.  * The writeProc procedure is similar to readProc, except that it is
  229.  * called when the buffer has filled (writeCount just became zero);
  230.  * its job is to write out the contents of the buffer and reset
  231.  * lastAccess and writeCount.  If the flush parameter is non-zero, then
  232.  * the procedure is being called as part of fflush, and it MUST empty
  233.  * the buffer.  Otherwise, the procedure may, if it chooses, increase
  234.  * the size of the buffer and return without actually writing anything.
  235.  *
  236.  * The third procedure, closeProc, is called when the stream is closed
  237.  * (writeProc is also called on close, before closeProc).  CloseProc
  238.  * should take any client-specific closing actions, such as closing
  239.  * the file corresponding to the stream or freeing the buffer space
  240.  * for the stream.  Its return value will be the return value from
  241.  * the fclose call.  If an error occurs while closing the stream, then
  242.  * the FILE structure should not be de-allocated, since the client will
  243.  * need to get at information in it to find out what went wrong.
  244.  *
  245.  * The procedures have the following calling sequences:
  246.  *
  247.  *    void readProc(stream)
  248.  *        FILE *stream;
  249.  *    {
  250.  *    }
  251.  
  252.  *    void writeProc(stream, flush)
  253.  *        FILE *stream;
  254.  *        Boolean flush;
  255.  *    {
  256.  *    }
  257.  
  258.  *    int closeProc(stream)
  259.  *        FILE *stream;
  260.  *    {
  261.  *    }
  262.  *
  263.  * See StdIoFileReadProc, StdIoFileWriteProc, and StdIoFileCloseProc for
  264.  * examples of these procedures.
  265.  */
  266.  
  267. typedef struct _file {
  268.     unsigned char *lastAccess;    /* Place (in buffer) from which last input
  269.                  * or output byte was read or written
  270.                  * (respectively). */
  271.     int readCount;        /* # of characters that may be read from
  272.                  * buffer before calling readProc to refill
  273.                  * the buffer. */
  274.     int writeCount;        /* # of characters that may be written into
  275.                  * buffer before calling writeProc to empty
  276.                  * the buffer.  WriteProc is called immediately
  277.                  * when the buffer fills, so that this value
  278.                  * is never zero unless the stream is not
  279.                  * currently being used for writing. */
  280.     unsigned char *buffer;    /* Pointer to storage for characters.  NULL
  281.                  * means storage hasn't been allocated yet. */
  282.     int bufSize;        /* Total number of bytes of storage available
  283.                  * in buffer. 0 means storage for buffer hasn't
  284.                  * been allocated yet. */
  285.     void (*readProc)_ARGS_((struct _file *));
  286.                 /* Procedure called to refill buffer. */
  287.     void (*writeProc)_ARGS_((struct _file *, Boolean));
  288.                 /* Procedure called to empty buffer. */
  289.     int (*closeProc)_ARGS_((struct _file *));
  290.                 /* Procedure called to close stream.  NULL
  291.                  * means no procedure to call. */
  292.     ClientData clientData;    /* Additional data for the use of the
  293.                  * procedures above,  e.g. the stream ID used
  294.                  * in kernel calls. */
  295.     int status;            /* Non-zero means an error has occurred while
  296.                  * emptying or filling the buffer.  This field
  297.                  * is set by readProc and writeProc. */
  298.     int flags;            /* Miscellaneous flags.  See below for values.
  299.                  */
  300.     struct _file *nextPtr;    /* For file streams, this is used to link all
  301.                  * file streams together (NULL means end of
  302.                  * list).  For other types of streams, it can
  303.                  * be used for anything desired by the
  304.                  * stream implementor. */
  305. } FILE;
  306.  
  307. /* Flags for FILEs:
  308.  *
  309.  * STDIO_READ:        Means that this stream is used for input.
  310.  * STDIO_WRITE:        Means that this stream is used for output.
  311.  * STDIO_EOF:        Means that an end-of-file has been encountered
  312.  *            on this stream.  All future reads will fail.
  313.  * STDIO_LINEBUF:    Means that this stream is line-buffered:  flush when
  314.  *            a newline is output or stdin is read.
  315.  * STDIO_NOT_OUR_BUF:      Means that the buffer for the stream belongs to someone
  316.  *                  else and should not be freed by the stdio library.
  317.  * 
  318.  */
  319.  
  320. #define STDIO_READ        1
  321. #define STDIO_WRITE        2
  322. #define STDIO_EOF        4
  323. #define STDIO_LINEBUF        8
  324. #define STDIO_NOT_OUR_BUF    16
  325.  
  326. /*
  327.  *----------------------------------------------------------------------
  328.  *
  329.  * getc --
  330.  * getchar --
  331.  * putc --
  332.  * putchar --
  333.  *
  334.  *    These four macros are used to input the next character from
  335.  *    a FILE or output the next character to a FILE.  Normally they
  336.  *    just move a character to or from a buffer, but if the buffer is
  337.  *    full (or empty) then they call a slow procedure to empty (or fill)
  338.  *    the buffer.
  339.  *
  340.  *    These macros are somewhat gross. putc is a ternary operator
  341.  *    to allow people to say things like
  342.  *
  343.  *        if (a)
  344.  *              putc(stdout, '\n');
  345.  *        else ...
  346.  *
  347.  *    If it were a complex expression, the compiler would complain.
  348.  *
  349.  * Results:
  350.  *    None.
  351.  *
  352.  * Side effects:
  353.  *    Information is modified in stream's buffer.
  354.  *
  355.  *----------------------------------------------------------------------
  356.  */
  357.  
  358. #ifndef lint
  359. #define getc(stream)                             \
  360.     (((stream)->readCount <= 0) ?                                       \
  361.         fgetc(stream) :                        \
  362.         ((stream)->readCount -= 1,                             \
  363.          (stream)->lastAccess += 1,                        \
  364.          *((stream)->lastAccess)))
  365.  
  366. #define putc(c, stream)                                                \
  367.     ((((stream)->writeCount <= 1) || ((stream)->flags & STDIO_LINEBUF)) ? \
  368.         fputc(c, stream) :                                  \
  369.         ((stream)->writeCount -= 1,                                    \
  370.          (stream)->lastAccess += 1,                                    \
  371.          *(stream)->lastAccess = c))
  372. #else
  373. _EXTERN int getc _ARGS_((FILE stream));
  374. _EXTERN int putc _ARGS_((int c, FILE stream));
  375. #endif
  376.  
  377. #define getchar() getc(stdin)
  378.  
  379. #define putchar(c) putc(c, stdout)
  380.  
  381. /*
  382.  *----------------------------------------------------------------------
  383.  *
  384.  * ferror --
  385.  * feof --
  386.  *
  387.  *    These two macros return information about whether an error
  388.  *    or end-of-file condition has occurred on a stream.
  389.  *
  390.  * Results:
  391.  *    ferror returns 0 if no error has occurred on the stream;
  392.  *    if an error has occurred then it returns the error code.
  393.  *    feof returns 0 if no end-of-file has been encountered on
  394.  *    the stream, and TRUE (non-zero) if an end-of-file has been
  395.  *    encountered.
  396.  *
  397.  * Side effects:
  398.  *    None.
  399.  *
  400.  *----------------------------------------------------------------------
  401.  */
  402.  
  403. #define ferror(stream) ((stream)->status)
  404. #define feof(stream) ((stream)->flags & STDIO_EOF)
  405.  
  406.  
  407. /*
  408.  *----------------------------------------------------------------------
  409.  *
  410.  * Miscellaneous additional things exported by stdio:
  411.  *
  412.  *----------------------------------------------------------------------
  413.  */
  414.  
  415. /*
  416.  * Handles for standard input and output channels.
  417.  */
  418.  
  419. extern FILE stdioInFile, stdioOutFile, stdioErrFile;
  420. #define stdin    (&stdioInFile)
  421. #define stdout    (&stdioOutFile)
  422. #define stderr    (&stdioErrFile)
  423.  
  424. /*
  425.  * Default buffer size:
  426.  */
  427.  
  428. #define BUFSIZ            4096
  429.  
  430. /*
  431.  * Flags to setvbuf:
  432.  */
  433.  
  434. #define _IOFBF        1
  435. #define _IOLBF        2
  436. #define _IONBF        3
  437.  
  438. /*
  439.  * Relative position indicator for fseek:
  440.  */
  441.  
  442. #define SEEK_SET    0
  443. #define SEEK_CUR    1
  444. #define SEEK_END    2
  445.  
  446. /*
  447.  *----------------------------------------------------------------------
  448.  *
  449.  * Procedures exported by the stdio module:
  450.  * (Note that these declarations are missing the "const" modifiers
  451.  * found in the ANSI version...)
  452.  * 
  453.  *----------------------------------------------------------------------
  454.  */
  455.  
  456. _EXTERN void    clearerr _ARGS_((FILE *stream));
  457. _EXTERN int    fclose _ARGS_((FILE *stream));
  458. _EXTERN FILE *    fdopen _ARGS_((int streamID, char *access));
  459. _EXTERN int    fflush _ARGS_((FILE *stream));
  460. _EXTERN int    fgetc _ARGS_((FILE *stream));
  461. _EXTERN char *    fgets _ARGS_((char *bufferPtr, int maxChars, FILE *stream));
  462. _EXTERN int    fileno _ARGS_((FILE *stream));
  463. _EXTERN FILE *    fopen _ARGS_((_CONST char *fileName, _CONST char *access));
  464. _EXTERN int    fputc _ARGS_((int c, FILE *stream));
  465. _EXTERN int    fputs _ARGS_((char *string, FILE *stream));
  466. _EXTERN int    fread _ARGS_((char *bufferPtr, int size, int numItems,
  467.                   FILE *stream));
  468. _EXTERN FILE *    freopen _ARGS_((_CONST char *fileName,
  469.                                 _CONST char *access, FILE *stream));
  470. _EXTERN long    fseek _ARGS_((FILE *stream, long offset, int base));
  471. _EXTERN long    ftell _ARGS_((FILE *stream));
  472. _EXTERN int    fwrite _ARGS_((char *bufferPtr, int size, int numItems,
  473.                    FILE *stream));
  474. _EXTERN char *    gets _ARGS_((char *bufferPtr));
  475. _EXTERN int    getw _ARGS_((FILE *stream));
  476. _EXTERN void    perror _ARGS_((_CONST char *msg));
  477. _EXTERN FILE *    popen _ARGS_((_CONST char *cmd, char *mode));
  478. _EXTERN int    pclose _ARGS_((FILE *ptr));
  479. _EXTERN int      remove _ARGS_((_CONST char *filename));
  480. _EXTERN int      rename _ARGS_((_CONST char *oldname, _CONST char *newname));
  481.  
  482. #ifdef KERNEL
  483. /*
  484.  * Special-case declarations for kernels:
  485.  * Printf returns void because the old Sys_Printf did.
  486.  * Varargs declarations aren't easy to do across all machines, so 
  487.  * we'll punt on them for now.
  488.  */
  489. _EXTERN void    printf _ARGS_(());
  490. _EXTERN int    fprintf _ARGS_(());
  491. _EXTERN int    scanf _ARGS_(());
  492. _EXTERN char *    sprintf _ARGS_(());
  493. _EXTERN int    sscanf _ARGS_(());
  494. _EXTERN int    fscanf _ARGS_(());
  495. _EXTERN int    vfprintf _ARGS_(());
  496. _EXTERN int    vfscanf _ARGS_(());
  497. _EXTERN int    vprintf _ARGS_(());
  498. _EXTERN char *    vsprintf _ARGS_(());
  499. #else /* KERNEL */
  500. /* 
  501.  * User-mode declarations for the routines in the special-case section:
  502.  * Note that the prototype declarations are actually no-ops until 
  503.  * _ARGS_ is turned on for user code.  Also, the varargs declarations 
  504.  * are only a first cut; there no guarantee they'll actually work when 
  505.  * _ARGS_ is turned on.
  506.  */
  507. _EXTERN int    printf _ARGS_((_CONST char *format, ...));
  508. _EXTERN int    fprintf _ARGS_((FILE *stream, _CONST char *format, ...));
  509. _EXTERN int    scanf _ARGS_((_CONST char *format, ...));
  510. _EXTERN char *    sprintf _ARGS_((char *s, _CONST char *format, ...));
  511. _EXTERN int    sscanf _ARGS_((char *s, _CONST char *format, ...));
  512. _EXTERN int    fscanf _ARGS_((FILE *stream, _CONST char *format, ...));
  513. _EXTERN int    vfprintf _ARGS_((FILE *stream,
  514.                                  _CONST char *format, va_list args));
  515. _EXTERN int    vfscanf _ARGS_((FILE *stream,
  516.                                 _CONST char *format, va_list args));
  517. _EXTERN int    vprintf _ARGS_((_CONST char *format, va_list args));
  518. _EXTERN char *    vsprintf _ARGS_((char *string,
  519.                                  _CONST char *format, va_list args));
  520. #endif /* KERNEL */
  521.  
  522. _EXTERN int    puts _ARGS_((_CONST char *string));
  523. _EXTERN int    putw _ARGS_((int w, FILE *stream));
  524. _EXTERN void    rewind _ARGS_((FILE *stream));
  525. _EXTERN void    setbuf _ARGS_((FILE *stream, char *buf));
  526. _EXTERN void    setbuffer _ARGS_((FILE *stream, char *buf, int size));
  527. _EXTERN void    setlinebuf _ARGS_((FILE *stream));
  528. _EXTERN int    setvbuf _ARGS_((FILE *stream, char *buf, int mode, int size));
  529. _EXTERN FILE *    tmpfile _ARGS_((void));
  530. _EXTERN char *    tmpnam _ARGS_((char *s));
  531. _EXTERN char *    tempnam _ARGS_((char *dir, char *pfx));
  532. _EXTERN int    ungetc _ARGS_((int c, FILE *stream));
  533. _EXTERN void    _cleanup _ARGS_((void));
  534.  
  535. _EXTERN void    Stdio_Setup _ARGS_((FILE *stream, int readable, int writable,
  536.                 unsigned char *buffer, int bufferSize,
  537.                 void (*readProc)(FILE * file),
  538.                 void (*writeProc)(FILE * file, Boolean flush),
  539.                 int (*closeProc)(FILE * file),
  540.                 ClientData clientData));
  541.  
  542. #endif /* _STDIO_H */
  543. @
  544.  
  545.  
  546. 1.27
  547. log
  548. @Use _HAS_PROTOTYPES instead of KERNEL to decide whether to include
  549. <stdio.h>.  This supports user-level programs that want to use
  550. prototypes.
  551. @
  552. text
  553. @d17 1
  554. a17 1
  555.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.26 90/12/07 23:46:20 rab Exp Locker: ouster $ SPRITE (Berkeley)
  556. d307 1
  557. a307 1
  558. _EXTERN long    fseek _ARGS_((FILE *stream, int offset, int base));
  559. @
  560.  
  561.  
  562. 1.27.1.1
  563. log
  564. @Initial branch for Sprite server.
  565. @
  566. text
  567. @d17 1
  568. a17 1
  569.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.27 91/12/05 10:44:56 ouster Exp $ SPRITE (Berkeley)
  570. @
  571.  
  572.  
  573. 1.26
  574. log
  575. @Added typedef of va_list for prototypes.
  576. @
  577. text
  578. @d17 1
  579. a17 1
  580.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.25 90/11/06 17:20:54 rab Exp Locker: rab $ SPRITE (Berkeley)
  581. d26 3
  582. a28 5
  583.  * typedefs.  Because practically everyone uses stdio.h, we should
  584.  * give advance warning before forcing users to use the typedefs from
  585.  * sprite.h.  This must be done before we can turn on function
  586.  * prototypes for Sprite user program.  (Or, change the prototypes so 
  587.  * that they don't use the Sprite typedefs.)
  588. d32 1
  589. a32 1
  590. #ifdef KERNEL
  591. @
  592.  
  593.  
  594. 1.25
  595. log
  596. @Changed extern to _EXTERN for g++.
  597. @
  598. text
  599. @d17 1
  600. a17 1
  601.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.24 90/09/20 15:48:34 mgbaker Exp Locker: rab $ SPRITE (Berkeley)
  602. d49 5
  603. @
  604.  
  605.  
  606. 1.24
  607. log
  608. @Fixed prototype problem that unleashed a bug in cproto.
  609. @
  610. text
  611. @d17 1
  612. a17 1
  613.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.23 90/09/11 16:45:07 mendel Exp Locker: mgbaker $ SPRITE (Berkeley)
  614. d20 2
  615. a21 2
  616. #ifndef _STDIO
  617. #define _STDIO
  618. d207 2
  619. a208 1
  620. extern int getc(), putc();
  621. d290 11
  622. a300 11
  623. extern void    clearerr _ARGS_((FILE *stream));
  624. extern int    fclose _ARGS_((FILE *stream));
  625. extern FILE *    fdopen _ARGS_((int streamID, char *access));
  626. extern int    fflush _ARGS_((FILE *stream));
  627. extern int    fgetc _ARGS_((FILE *stream));
  628. extern char *    fgets _ARGS_((char *bufferPtr, int maxChars, FILE *stream));
  629. extern int    fileno _ARGS_((FILE *stream));
  630. extern FILE *    fopen _ARGS_((char *fileName, char *access));
  631. extern int    fputc _ARGS_((int c, FILE *stream));
  632. extern int    fputs _ARGS_((char *string, FILE *stream));
  633. extern int    fread _ARGS_((char *bufferPtr, int size, int numItems,
  634. d302 5
  635. a306 4
  636. extern FILE *    freopen _ARGS_((char *fileName, char *access, FILE *stream));
  637. extern long    fseek _ARGS_((FILE *stream, int offset, int base));
  638. extern long    ftell _ARGS_((FILE *stream));
  639. extern int    fwrite _ARGS_((char *bufferPtr, int size, int numItems,
  640. d308 7
  641. a314 5
  642. extern char *    gets _ARGS_((char *bufferPtr));
  643. extern int    getw _ARGS_((FILE *stream));
  644. extern void    perror _ARGS_((char *msg));
  645. extern FILE *    popen _ARGS_((char *cmd, char *mode));
  646. extern int    pclose _ARGS_((FILE *ptr));
  647. d323 10
  648. a332 10
  649. extern void    printf _ARGS_(());
  650. extern int    fprintf _ARGS_(());
  651. extern int    scanf _ARGS_(());
  652. extern char *    sprintf _ARGS_(());
  653. extern int    sscanf _ARGS_(());
  654. extern int    fscanf _ARGS_(());
  655. extern int    vfprintf _ARGS_(());
  656. extern int    vfscanf _ARGS_(());
  657. extern int    vprintf _ARGS_(());
  658. extern char *    vsprintf _ARGS_(());
  659. d341 13
  660. a353 10
  661. extern int    printf _ARGS_((char *format, ...));
  662. extern int    fprintf _ARGS_((FILE *stream, char *format, ...));
  663. extern int    scanf _ARGS_((char *format, ...));
  664. extern char *    sprintf _ARGS_((char *s, char *format, ...));
  665. extern int    sscanf _ARGS_((char *s, char *format, ...));
  666. extern int    fscanf _ARGS_((FILE *stream, char *format, ...));
  667. extern int    vfprintf _ARGS_((FILE *stream, char *format, va_list args));
  668. extern int    vfscanf _ARGS_((FILE *stream, char *format, va_list args));
  669. extern int    vprintf _ARGS_((char *format, va_list args));
  670. extern char *    vsprintf _ARGS_((char *string, char *format, va_list args));
  671. d356 12
  672. a367 12
  673. extern int    puts _ARGS_((char *string));
  674. extern int    putw _ARGS_((int w, FILE *stream));
  675. extern void    rewind _ARGS_((FILE *stream));
  676. extern void    setbuf _ARGS_((FILE *stream, char *buf));
  677. extern void    setbuffer _ARGS_((FILE *stream, char *buf, int size));
  678. extern void    setlinebuf _ARGS_((FILE *stream));
  679. extern int    setvbuf _ARGS_((FILE *stream, char *buf, int mode, int size));
  680. extern FILE *    tmpfile _ARGS_((void));
  681. extern char *    tmpnam _ARGS_((char *s));
  682. extern char *    tempnam _ARGS_((char *dir, char *pfx));
  683. extern int    ungetc _ARGS_((int c, FILE *stream));
  684. extern void    _cleanup _ARGS_((void));
  685. d369 1
  686. a369 1
  687. extern void    Stdio_Setup _ARGS_((FILE *stream, int readable, int writable,
  688. d376 1
  689. a376 1
  690. #endif /* _STDIO */
  691. @
  692.  
  693.  
  694. 1.23
  695. log
  696. @Corrected prototype for Stdio_Setup.
  697. @
  698. text
  699. @d17 1
  700. a17 1
  701.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.22 90/09/11 14:35:26 kupfer Exp Locker: mendel $ SPRITE (Berkeley)
  702. d363 5
  703. a367 5
  704.                     unsigned char *buffer, int bufferSize,
  705.                     void (*readProc)(FILE *),
  706.                     void (*writeProc)(FILE *, Boolean),
  707.                     int (*closeProc)(FILE *),
  708.                     ClientData clientData));
  709. @
  710.  
  711.  
  712. 1.22
  713. log
  714. @Clean up function prototypes some.
  715. @
  716. text
  717. @d17 1
  718. a17 1
  719.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.21 90/09/03 22:23:56 shirriff Exp Locker: kupfer $ SPRITE (Berkeley)
  720. d365 1
  721. a365 1
  722.                     void (*writeProc)(FILE *),
  723. @
  724.  
  725.  
  726. 1.21
  727. log
  728. @Changed printf args and varargs declaration so this would work in
  729. the kernel.
  730. @
  731. text
  732. @d17 1
  733. a17 1
  734.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.20 90/09/03 11:01:36 kupfer Exp Locker: shirriff $ SPRITE (Berkeley)
  735. d23 12
  736. d36 1
  737. a36 5
  738. #if defined(__STDC__) && !defined(spur) && !defined(sun4) && !defined(KERNEL)
  739. #include <stdarg.h>
  740. #else
  741. #include <varargs.h>
  742. #endif /* STDC */
  743. d297 1
  744. a297 1
  745. extern int    fputc _ARGS_((char c, FILE *stream));
  746. d314 4
  747. a317 3
  748.  * If we're in the kernel, we want printf to return void, since the old
  749.  * Sys_Printf did.
  750.  * Also, varargs declarations aren't working yet for the kernel.
  751. d325 12
  752. a336 1
  753. #else
  754. d343 4
  755. d348 1
  756. a359 4
  757. extern int    vfprintf _ARGS_((FILE *stream, char *format, va_list args));
  758. extern int    vfscanf _ARGS_((FILE *stream, char *format, va_list args));
  759. extern int    vprintf _ARGS_((char *format, va_list args));
  760. extern char *    vsprintf _ARGS_((char *string, char *format, va_list args));
  761. d362 6
  762. a367 1
  763. extern void    Stdio_Setup();
  764. @
  765.  
  766.  
  767. 1.20
  768. log
  769. @Added prototyping declarations.  (Checked in by shirriff)
  770. @
  771. text
  772. @d17 1
  773. a17 1
  774.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.19 90/06/27 13:29:57 shirriff Exp Locker: kupfer $ SPRITE (Berkeley)
  775. d24 1
  776. a24 1
  777. #if defined(__STDC__) && !defined(spur) && !defined(sun4)
  778. d28 1
  779. a28 1
  780. #endif
  781. a288 1
  782. extern int    fprintf _ARGS_((FILE *stream, char *format, ...));
  783. a293 1
  784. extern int    fscanf _ARGS_((FILE *stream, char *format, ...));
  785. d308 1
  786. d310 6
  787. a315 1
  788. extern void    printf _ARGS_((char *format, ...));
  789. d318 5
  790. a326 1
  791. extern int    scanf _ARGS_((char *format, ...));
  792. a330 2
  793. extern char *    sprintf _ARGS_((char *s, char *format, ...));
  794. extern int    sscanf _ARGS_((char *s, char *format, ...));
  795. @
  796.  
  797.  
  798. 1.19
  799. log
  800. @Fixed declaration of pclose().
  801. @
  802. text
  803. @d17 1
  804. a17 1
  805.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.18 90/06/21 09:47:47 rab Exp $ SPRITE (Berkeley)
  806. d23 7
  807. d111 6
  808. a116 3
  809.     void (*readProc)();        /* Procedure called to refill buffer. */
  810.     void (*writeProc)();    /* Procedure called to empty buffer. */
  811.     int (*closeProc)();        /* Procedure called to close stream.  NULL
  812. d275 3
  813. a277 1
  814.  *
  815. d281 24
  816. a304 22
  817. extern void    clearerr();
  818. extern int    fclose();
  819. extern FILE *    fdopen();
  820. extern int    fflush();
  821. extern int    fgetc();
  822. extern char *    fgets();
  823. extern int    fileno();
  824. extern FILE *    fopen();
  825. extern int    fprintf();
  826. extern int    fputc();
  827. extern int    fputs();
  828. extern int    fread();
  829. extern FILE *    freopen();
  830. extern int    fscanf();
  831. extern long    fseek();
  832. extern long    ftell();
  833. extern int    fwrite();
  834. extern char *    gets();
  835. extern int    getw();
  836. extern void    perror();
  837. extern FILE *   popen();
  838. extern int      pclose();
  839. d311 1
  840. a311 1
  841. extern void    printf();
  842. d313 1
  843. a313 1
  844. extern int    printf();
  845. d315 19
  846. a333 19
  847. extern int    puts();
  848. extern int    putw();
  849. extern void    rewind();
  850. extern int    scanf();
  851. extern void    setbuf();
  852. extern void    setbuffer();
  853. extern void    setlinebuf();
  854. extern int    setvbuf();
  855. extern char *    sprintf();
  856. extern int    sscanf();
  857. extern FILE *    tmpfile();
  858. extern char *    tmpnam();
  859. extern char *    tempnam();
  860. extern int    ungetc();
  861. extern int    vfprintf();
  862. extern int    vfscanf();
  863. extern int    vprintf();
  864. extern char *    vsprintf();
  865. extern void    _cleanup();
  866. @
  867.  
  868.  
  869. 1.18
  870. log
  871. @Added forward declarations for popen and pclose.
  872. @
  873. text
  874. @d17 1
  875. a17 1
  876.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.17 89/06/23 11:30:01 rab Exp Locker: rab $ SPRITE (Berkeley)
  877. d290 1
  878. a290 1
  879. extern void     pclose();
  880. @
  881.  
  882.  
  883. 1.17
  884. log
  885. @*** empty log message ***
  886. @
  887. text
  888. @d17 1
  889. a17 1
  890.  * $Header: /sprite/src/lib/include/RCS/stdio.h,v 1.16 88/11/23 17:38:05 mlgray Exp Locker: rab $ SPRITE (Berkeley)
  891. d289 3
  892. @
  893.  
  894.  
  895. 1.16
  896. log
  897. @Added ifdef for KERNEL printf to return void rather than an integer
  898. for backwards compatibility.
  899. @
  900. text
  901. @d17 1
  902. a17 1
  903.  * $Header: /sprite/src/lib/include.new/RCS/stdio.h,v 1.15 88/09/28 09:20:58 ouster Exp Locker: mlgray $ SPRITE (Berkeley)
  904. d320 1
  905. a320 1
  906. #endif _STDIO
  907. @
  908.  
  909.  
  910. 1.15
  911. log
  912. @Added tmpnam, tmpname, tmpfile.
  913. @
  914. text
  915. @d17 1
  916. a17 1
  917.  * $Header: stdio.h,v 1.14 88/09/14 10:40:52 ouster Exp $ SPRITE (Berkeley)
  918. d289 7
  919. d297 1
  920. @
  921.  
  922.  
  923. 1.14
  924. log
  925. @Remove panic declaration.
  926. @
  927. text
  928. @d17 1
  929. a17 1
  930.  * $Header: stdio.h,v 1.13 88/07/28 16:43:57 ouster Exp $ SPRITE (Berkeley)
  931. d51 1
  932. a51 1
  933.  * the procedure is being called as part of Io_Flush, and it MUST empty
  934. d123 1
  935. a123 1
  936. /* Flags for Io_Streams:
  937. d264 1
  938. a264 1
  939.  * Procedures exported by the Io module:
  940. d300 3
  941. @
  942.  
  943.  
  944. 1.13
  945. log
  946. @Don't make bufSize unsigned.  Too much hassle.
  947. @
  948. text
  949. @d17 1
  950. a17 1
  951.  * $Header: stdio.h,v 1.12 88/07/25 13:59:27 ouster Exp $ SPRITE (Berkeley)
  952. a287 1
  953. extern void    panic();
  954. @
  955.  
  956.  
  957. 1.12
  958. log
  959. @Add lint-related stuff to check getc and putc calls better.
  960. @
  961. text
  962. @d17 1
  963. a17 1
  964.  * $Header: stdio.h,v 1.11 88/07/25 11:02:38 ouster Exp $ SPRITE (Berkeley)
  965. d101 1
  966. a101 1
  967.     unsigned int bufSize;    /* Total number of bytes of storage available
  968. @
  969.  
  970.  
  971. 1.11
  972. log
  973. @Declare Stdio_Setup().
  974. @
  975. text
  976. @d17 1
  977. a17 1
  978.  * $Header: stdio.h,v 1.10 88/07/21 16:03:45 ouster Exp $ SPRITE (Berkeley)
  979. d174 1
  980. d188 3
  981. @
  982.  
  983.  
  984. 1.10
  985. log
  986. @Change return type of fseek.
  987. @
  988. text
  989. @d17 1
  990. a17 1
  991.  * $Header: stdio.h,v 1.9 88/07/21 08:43:43 ouster Exp $ SPRITE (Berkeley)
  992. d303 2
  993. @
  994.  
  995.  
  996. 1.9
  997. log
  998. @Eliminated _doprnt and _doscan, replaced with vfscanf, vfprintf, etc.
  999. @
  1000. text
  1001. @d17 1
  1002. a17 1
  1003.  * $Header: stdio.h,v 1.8 88/07/20 18:12:28 ouster Exp $ SPRITE (Berkeley)
  1004. d279 1
  1005. a279 1
  1006. extern int    fseek();
  1007. @
  1008.  
  1009.  
  1010. 1.8
  1011. log
  1012. @Added link field for change to file streams (let there be more
  1013. than one FILE open for a single stream id).
  1014. @
  1015. text
  1016. @d17 1
  1017. a17 1
  1018.  * $Header: stdio.h,v 1.7 88/07/15 17:28:13 ouster Exp $ SPRITE (Berkeley)
  1019. d298 4
  1020. a302 2
  1021. extern int    _doprnt();
  1022. extern int    _doscan();
  1023. @
  1024.  
  1025.  
  1026. 1.7
  1027. log
  1028. @No need to include sprite.h anymore.
  1029. @
  1030. text
  1031. @d17 1
  1032. a17 1
  1033.  * $Header: stdio.h,v 1.6 88/07/11 09:09:56 ouster Exp $ SPRITE (Berkeley)
  1034. d86 1
  1035. a86 1
  1036. typedef struct {
  1037. d116 5
  1038. @
  1039.  
  1040.  
  1041. 1.6
  1042. log
  1043. @Make ftell return "long".
  1044. @
  1045. text
  1046. @d17 1
  1047. a17 1
  1048.  * $Header: stdio.h,v 1.5 88/07/05 10:11:23 ouster Exp $ SPRITE (Berkeley)
  1049. d23 2
  1050. a24 2
  1051. #ifndef _SPRITE
  1052. #include <sprite.h>
  1053. d27 7
  1054. a33 2
  1055. #ifndef EOF
  1056. #define EOF (-1)
  1057. @
  1058.  
  1059.  
  1060. 1.5
  1061. log
  1062. @Typo in last change.
  1063. @
  1064. text
  1065. @d17 1
  1066. a17 1
  1067.  * $Header: stdio.h,v 1.3 88/07/05 09:05:34 ouster Exp $ SPRITE (Berkeley)
  1068. d270 1
  1069. a270 1
  1070. extern int    ftell();
  1071. @
  1072.  
  1073.  
  1074. 1.4
  1075. log
  1076. @Re-did last change.
  1077. @
  1078. text
  1079. @d172 1
  1080. a172 1
  1081.     ((((stream)->writeCount <= 1) || (stream->flags & STDIO_LINEBUF)) ?    \
  1082. @
  1083.  
  1084.  
  1085. 1.3
  1086. log
  1087. @Putc was evaluation c twice, which goofed up old programs that
  1088. depend on its only being evaluated once.  The second evaluation
  1089. was unnecessary anyway.
  1090. @
  1091. text
  1092. @d17 1
  1093. a17 1
  1094.  * $Header: stdio.h,v 1.2 88/06/26 16:05:04 ouster Exp $ SPRITE (Berkeley)
  1095. d172 1
  1096. a172 1
  1097.     (((stream)->writeCount <= 1) ?                     \
  1098. @
  1099.  
  1100.  
  1101. 1.2
  1102. log
  1103. @Define perror.
  1104. @
  1105. text
  1106. @d17 1
  1107. a17 1
  1108.  * $Header: stdio.h,v 1.1 88/06/21 09:36:57 ouster Exp $ SPRITE (Berkeley)
  1109. d172 1
  1110. a172 1
  1111.     ((((stream)->writeCount <= 1) || (c == '\n')) ?                     \
  1112. d174 1
  1113. a174 1
  1114.              ((stream)->writeCount -= 1,                                    \
  1115. @
  1116.  
  1117.  
  1118. 1.1
  1119. log
  1120. @Initial revision
  1121. @
  1122. text
  1123. @d17 1
  1124. a17 1
  1125.  * $Header: stdio.h,v 1.2 88/06/18 14:47:39 ouster Exp $ SPRITE (Berkeley)
  1126. d275 1
  1127. @
  1128.